// Copyright  2004-2008 Backplane Ltd.
//
// This file is part of Ubiquity formsPlayer
//
// Ubiquity formsPlayer is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3 of the License, or (at your
// option) any later version.
//
// Ubiquity formsPlayer is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License
// along with Ubiquity formsPlayer If not, see <http://www.gnu.org/licenses/>.
//	
//
//   Purpose:  HRESULT return code values for FormsPlayer project..
//   $Id$

#ifndef __FORMSPLAYER_RETURN_CODES_H__
#define __FORMSPLAYER_RETURN_CODES_H__

#include <Common/ReturnCodes/ReturnCodes.h>

HRESULT SetupErrorInfo(HRESULT errcode,const wchar_t * psParam=0);

class CErrorInfoHelper
{
public:
	HRESULT SetupErrorInfo(HRESULT errcode,...);
	CErrorInfoHelper(BSTR sSource);
	~CErrorInfoHelper();
private:
	CComBSTR m_sSource;
	CComPtr<IXMLDOMDocument> m_pXMLParser;
	HRESULT GetMessageFormatString(HRESULT code, CComBSTR & sFormatString);
};
///////////////////////////////////////////////////////////////////////
// Success codes
const HRESULT FP_S_NOTOK =				FP_SUCCESS_CODE(1); // This denotes that the last token is being returned.
const HRESULT FP_S_BADCFG =				FP_SUCCESS_CODE(2); // This denotes that a configuration file is invalid.

///////////////////////////////////////////////////////////////////////
// Error codes
const HRESULT FP_E_NOITF =				FP_ERROR_CODE(1); // Interface '%s' not supported.
const HRESULT FP_E_BADARG =				FP_ERROR_CODE(2); // Bad argument received by function '%s'.
const HRESULT FP_E_ANONINST =			FP_ERROR_CODE(3); // This functionality is unavailable for anonymous instances. To enable this functionality, please name your instance using the id= attribute.
const HRESULT FP_E_ANONMDL =			FP_ERROR_CODE(4); // This functionality is unavailable for anonymous models. To enable this functionality, please name your model using the id= attribute.
const HRESULT FP_E_NOINST =				FP_ERROR_CODE(5); // Unknown instance '%s'.
const HRESULT FP_E_DUPLICATE_PROPERTY =	FP_ERROR_CODE(6); // Duplicate model item property (%s) set .
const HRESULT FP_E_NOFRMCTRL =			FP_ERROR_CODE(7); // No form control object available inside function '%s'.
const HRESULT FP_E_NOMEM =				FP_ERROR_CODE(8); // Memory allocation failed inside function '%s'.
const HRESULT FP_E_QIFAIL =				FP_ERROR_CODE(9); // QueryInterface ('%s') failed.
const HRESULT FP_E_DOCNREADY =			FP_ERROR_CODE(10); // Function '%s' called before DocumentReady.
const HRESULT FP_E_NOCOM =				FP_ERROR_CODE(11); // A required formsPlayer component for the '%s' feature could not be loaded. formsPlayer may require repairing or reinstalling for you to continue.
const HRESULT FP_E_NORPT =				FP_ERROR_CODE(12); // Unrecognised repeat '%s' specified.
const HRESULT FP_E_BAD_REPLACE =		FP_ERROR_CODE(13); // Fatal Error Attempting to submit using unknown replace method \"%s\".
const HRESULT FP_E_BADLYFORMED_SCHEMA = FP_ERROR_CODE(14); // schema "%s" for model "%s" is not well formed:<br />%s<br />At: %s
const HRESULT FP_E_INVALID_SCHEMA =		FP_ERROR_CODE(15); // schema "%s" for model "%s" is not valid:<br />%s
const HRESULT FP_E_NO_NSRESOLVER =		FP_ERROR_CODE(16); // XPath namespace resolver could not be loaded.
const HRESULT FP_E_UNKNOWN_MODEL =		FP_ERROR_CODE(17); // Requested model "%s" does not exist.
const HRESULT FP_E_UNKNOWN_BIND =		FP_ERROR_CODE(18); // Requested bind "%s" does not exist.
const HRESULT FP_E_FOPERR =				FP_ERROR_CODE(19); // Error opening file "%s".
const HRESULT FP_E_BADCFG =				FP_ERROR_CODE(20); // Invalid configuration file '%s' found - aborting operation.<br />Please contact the administrator of this web site to inform them of this problem.
const HRESULT FP_E_DUPLICATE_MODEL =	FP_ERROR_CODE(21); // Duplicate model-id "%s" encountered.
const HRESULT FP_E_DUPLICATE_INSTANCE =	FP_ERROR_CODE(22); // Duplicate instance-id "%s" encountered.
const HRESULT FP_E_UNKNOWN_ELEMENT =	FP_ERROR_CODE(23); // Could not understand element\"%S\" with xforms:mustunderstand=\"true\".
const HRESULT FP_E_NO_NAMESPACE =		FP_ERROR_CODE(24); // No compatible xforms namespace declaration could be found - <br /> should be xmlns:prefix=\"%s\".
const HRESULT FP_E_UNKNOWN_SUBMISSION =	FP_ERROR_CODE(25); // Requested submission "%s" does not exist.
const HRESULT FP_E_REMFERR =			FP_ERROR_CODE(26); // Error reading remote file "%s".
const HRESULT FP_E_FTMPERR =			FP_ERROR_CODE(27); // Error accessing temporary file.
const HRESULT FP_E_REGEVT =				FP_ERROR_CODE(28); // Error registering event source.
const HRESULT FP_E_REGSET =				FP_ERROR_CODE(29); // Error setting registry value "%s".
const HRESULT FP_E_REGOPEN =			FP_ERROR_CODE(30); // Error opening registry key "%s".
const HRESULT FP_E_INVALID_INSTANCE =	FP_ERROR_CODE(31); // Attempting to send Invalid instance data.
const HRESULT FP_E_INVALID_MODEL	=	FP_ERROR_CODE(32); // Invalid model.
const HRESULT FP_E_INVALID_ACTION	=	FP_ERROR_CODE(33); // Invalid action.
const HRESULT FP_E_HTTP_ERROR_REASON =	FP_ERROR_CODE(34); // %s
const HRESULT FP_E_INVALID_INST_DATA =	FP_ERROR_CODE(35); // Received invalid or no instance data from resource.
const HRESULT FP_E_POST_DATA		 =	FP_ERROR_CODE(36); // Unable to submit data to specified resource.
const HRESULT FP_E_USERCANCEL =			FP_ERROR_CODE(37); // User has cancelled the operation.
const HRESULT FP_E_BADID =				FP_ERROR_CODE(38); // The identifier '%s' is invalid or was not recognised.
const HRESULT FP_E_INVALIDKEY =			FP_ERROR_CODE(39); // An invalid authorisation key has been supplied to formsPlayer, ignoring configuration file "%s".
const HRESULT FP_E_BAD_METHOD =			FP_ERROR_CODE(40); // Fatal Error Attempting to submit using a unknown submission method "%s".
const HRESULT FP_E_INVLDREPINST =		FP_ERROR_CODE(41); // Fatal Error Attempting to submit using a unknown submission method "%s".
const HRESULT FP_E_INVLDSUBEXT =		FP_ERROR_CODE(42); // Error determining value for submission extension "%s".

#endif
